package com.tanhua.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.manager.domain.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {

    @Select("SELECT COUNT(DISTINCT user_id) FROM tb_log " +
            " WHERE log_time = #{today} " +
            "   AND user_id IN (" +
            "       SELECT user_id FROM tb_log tl " +
            "        WHERE tl.type = '0102' " +
            "          AND tl.log_time = #{yesterday} " +
            "   )")
    Integer queryRetention(@Param("today") String today,
                           @Param("yesterday") String yesterday);
}
